use std::fmt;

pub struct Record {
    pub target: u8,
    pub time: chrono::DateTime<chrono::Local>,
    pub content: String,
}

impl Record {
    pub fn new(target: u8, time: chrono::DateTime<chrono::Local>, content: String) -> Self {
        Self {
            target,
            time,
            content,
        }
    }

    pub fn target(&self) -> usize {
        self.target as usize
    }
}

impl fmt::Display for Record {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "(target:{} content:{})", self.target, self.content)
    }
}
